package com.shujia.scala

object Demo8Extends {
  def main(args: Array[String]): Unit = {

    val a = new B("001", "张三", 23)


    println(a)
  }

}


class A(id: String, name: String) {

  val _id: String = id
  val _name: String = name


  override def toString = s"A(${_id}, ${_name})"
}

/**
  * 类的继承
  * 会继承父类的属性，方法
  *
  */
class B(id: String, name: String, age: Int) extends A(id, name) {

  val _age: Int = age

  //重写父类的方法
  override def toString = s"B(${_id}, ${_name},${_age})"
}
